# 添加代码片段 snippets
# 打开控制面板
快捷键 command + shift + p
搜索 Preferences: Configure User Snippets
选择 New Global Snippts file...
示例
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// 代码片段名称
"Print to console": {
// 作用范围
"scope": "javascript,typescript",
// 前缀
"prefix": "log",
// 代码片段
"body": [
// $1 光标出现的位置,如果不设置,默认出现在末尾
"console.log('$1');",
// 用tab可以切换到下一个参数位置
"$2"
],
// 描述
"description": "Log output to console"
}
}